#!/bin/bash 

MAILGUARD_ROOT=""

if [ ! -n "$MAILGUARD_ROOT" ]; then
  echo "I need the ROOT path to be defined consult the README and change this
  variable."
fi


perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./bin/loaddb
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./bin/lookup_in_loaddb.pl
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./bin/mailguard.pl
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./lib/EMS/Mailguard/Config.pm
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./web/cgi-bin/approve.cgi
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./web/cgi-bin/review.cgi
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ./web/cgi-bin/web/cgi-bin/update_config.cgi
perl -i -pe "s,%%MGPATH%%,$MAILGUARD_ROOT,g" ../additional_libraries/INSTALL.sh
